﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="category.ascx.cs" Inherits="basecon_category" %>
<div id="divCategory" runat="server">
    <asp:HiddenField ID="hidGuid" runat="server" Value="0" />
    <asp:HyperLink ID="hlCategory" NavigateUrl="javascript:void(0)" runat="server">HyperLink</asp:HyperLink>
    <div id="divSelect" runat="server" style="display: none; padding: 10px; max-height:500px; overflow:scroll">
        <div class="close">
            <asp:Image ID="imgX" runat="server" /></div>
        <div>
            <table class="altertab" style="width: 100%; margin-top: 10px">
                <tr bgcolor="#d4e3f6">
                    <th>
                        选择
                    </th>
                    <th>
                        类型
                    </th>
                    <th>
                        类型说明
                    </th>
                </tr>
                <tr style="cursor:pointer">
                    <td>
                        <input type="radio" value="0" name="<%=this.CategoryID %>" /></td>
                    <td>
                        无
                    </td>
                    <td>
                        无
                    </td>
                </tr>
                <%
                    foreach (System.Data.DataRow dr in dt.Rows)
                    {
                %>
                <tr style="cursor:pointer">
                    <td>
                        <input type="radio" value="<%=dr["Guid"] %>" name="<%=this.CategoryID %>" /></td>
                    <td>
                        <%=dr["Category"] %>
                    </td>
                    <td>
                        <%=dr["Intro"] %>
                    </td>
                </tr>
                <%
                    }
                %>
            </table>
        </div>
    </div>
</div>

<script type="text/javascript">
    $(document).ready(function() {
        $("#<%=this.divSelect.ClientID %> input[value='"+$("#<%=this.hidGuid.ClientID %>").val()+"']").attr("checked","checked");
        $("#<%=this.hlCategory.ClientID %>").html($("#<%=this.divSelect.ClientID %> input[value='"+$("#<%=this.hidGuid.ClientID %>").val()+"']").parent().next().html());
        $("#<%=this.hlCategory.ClientID %>").click(function(){
            $.blockUI({ message: $("#<%=this.divSelect.ClientID %>"),target: "#form1",css:{top:"30px"} });
        });
        $("#<%=this.divSelect.ClientID %> tr").click(function(){
            if($(this).find("input").length>0)
            {
                $("#<%=this.hlCategory.ClientID %>").html($(this).find("input").parent().next().html());
                $(this).find("input").attr("checked","checked");
                $("#<%=this.hidGuid.ClientID %>").val($(this).find("input").val());
                $.unblockUI();
            }
        });
	    $(".close").click(function(){$.unblockUI();});
    });
</script>

